package com.common.www.bean.entity.project;


import org.springframework.boot.base.jpa.domain.annotations.QueryCacheable;
import org.springframework.boot.base.jpa.domain.entity.NumberIdentityEntity;
import com.common.www.bean.entity.programme.BasisDemandDetails;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 项目
 *
 * @param
 * @author andyliu
 * @date 5/28/2018 4:23 PM
 * @return
 */
@DynamicUpdate(true)
@DynamicInsert(true)
@Entity
@Getter
@Setter
@QueryCacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Table()
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "project返回参数")
public class Project extends NumberIdentityEntity {
//    @JsonIgnoreProperties(value = {"parent", "children"})
//    @ManyToOne()
//    private Company company;

    /**
     * 项目名称
     */
    @Column(length = 512, nullable = false)
    @ApiModelProperty(value = "名称", example = "1")
    private String name;

    /**
     * 省份
     */
    @Column(nullable = false, length = 32)
    @ApiModelProperty(value = "省份", example = "四川省")
    private String province;
    /**
     * 城市
     */
    @Column(nullable = false, length = 32)
    @ApiModelProperty(value = "市", example = "成都市")
    private String city;

    /**
     * 招标时间
     */
    @Column(length = 11)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date biddingTime;

    /**
     * 定标时间
     */
    @Column(length = 11)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date calibrationTime;

    /**
     * 备注
     */
    @Column(length = 4096)
    @Length(max=4096,message = "备注最长不超过4096位")
    private String remarks;

    /**
     * 总建筑面积（㎡）
     */
    @NotNull(message = "请填写总建筑面积")
    @Column(length = 11, precision = 12, scale = 4)
    private Double zongArea;
    /**
     * 地下室建筑面积（㎡）
     */
    @NotNull(message = "请填写地下室建筑面积")
    @Column(length = 11, precision = 12, scale = 4)
    private Double diXiaShiArea;
    /**
     * 住宅建筑面积（㎡）
     */
    @NotNull(message = "请填写住宅建筑面积")
    @Column(length = 11, precision = 12, scale = 4)
    private Double zhuZhaiArea;
    /**
     * 其中：表箱上楼住宅建筑面积（㎡）
     */
    @NotNull(message = "请填写表箱上楼住宅建筑面积")
    @Column(length = 11, precision = 12, scale = 4)
    private Double biaoXiangShangArea;
    /**
     * 其中：表箱不上楼住宅建筑面积（㎡）
     */
    @NotNull(message = "请填写表箱不上楼住宅建筑面积")
    @Column(length = 11, precision = 12, scale = 4)
    private Double biaoXiangXiaArea;
    /**
     * 商业折算面积（㎡）
     */
    @NotNull(message = "请填写商业折算面积")
    @Column(length = 11, precision = 12, scale = 4)
    private Double shangYeArea;
    /**
     * 配套设施建筑面积（㎡）
     */
    @NotNull(message = "请填写配套设施建筑面积")
    @Column(length = 11, precision = 12, scale = 4)
    private Double peiTaoArea;
    /**
     * 住宅总户数（户）
     */
    @Column(length = 11)
    private Integer zongHuShu;
    /**
     * 项目业态(存在 地下室+高层 这样的组合形态)
     * 地下室、高层、小高层、洋房、别墅、商业、公寓、幼儿园
     */
    @Column(length = 128)
    private String yeTaiStr;

    @Transient
    @JsonIgnoreProperties(value = {"project"})
    private GdyBasic gdyBasic;
    @Transient
    @JsonIgnoreProperties(value = {"project"})
    private XfgcBasic xfgcBasic;

}